package com.csc.yunting.core.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

//@Configuration
//@ConfigurationProperties(prefix = "wx.login")
@Data
public class WxLoginProperties implements InitializingBean {
    private String apiUrl;//: https://open.weixin.qq.com/connect/qrconnect
    private String appid;//: wxed9954c01bb89b47
    private String secret;//: a7482517235173ddb4083788de60b90e
    private String redirectUri;//: http://localhost:8160/api/wx/callback
    private String callbackUrl;//: https://api.weixin.qq.com/sns/oauth2/access_token
    private String userInfoUrl;//: https://api.weixin.qq.com/sns/userinfo
    private String redirectUrl;//: http://localhost:3000

    public static String API_URL;//: https://open.weixin.qq.com/connect/qrconnect
    public static String APP_ID;//: wxed9954c01bb89b47
    public static String SECRET;//: a7482517235173ddb4083788de60b90e
    public static  String WX_REDIRECT_URI;//: http://localhost:8160/api/wx/callback
    public static  String CALLBACK_URL;//: https://api.weixin.qq.com/sns/oauth2/access_token
    public static  String USERINFO_URL;//: https://api.weixin.qq.com/sns/userinfo
    public static  String REDIRECT_URL;//: http://localhost:3000
    @Override
    public void afterPropertiesSet() throws Exception {

        API_URL = this.apiUrl;
        APP_ID = this.appid;
        SECRET = this.secret;
        WX_REDIRECT_URI = this.redirectUri;
        REDIRECT_URL = this.redirectUrl;
        CALLBACK_URL = this.callbackUrl;
        USERINFO_URL = this.userInfoUrl;

    }
}
